import { _decorator, Component, game, Node } from 'cc';
import { GameEvent } from './EventName';
const { ccclass, property } = _decorator;

@ccclass('GameUi')
export class GameUi extends Component {

    @property(Node)
    buttons: Node = null

    start() {
        this.hideAllBtnIcon();
        this.buttons.children[0].children[0].active = true;
        this.buttons.children[0].children[2].active = true;
    }

    homeBtnClick() {
        this.hideAllBtnIcon();
        this.buttons.children[0].children[0].active = true;
        this.buttons.children[0].children[2].active = true;
    }

    dangerousBtnClick() {
        this.hideAllBtnIcon();
        this.buttons.children[1].children[0].active = true;
        this.buttons.children[1].children[2].active = true;
    }

    transactionBtnClikc() {
        game.emit(GameEvent.SHOW_TOAST, "Coming Soon!");

        return
        this.hideAllBtnIcon();
        this.buttons.children[2].children[0].active = true;
        this.buttons.children[2].children[2].active = true;
    }

    weaponBtnClick() {
        this.hideAllBtnIcon();
        this.buttons.children[3].children[0].active = true;
        this.buttons.children[3].children[2].active = true;
    }

    activityBtnClick() {
        this.hideAllBtnIcon();
        this.buttons.children[4].children[0].active = true;
        this.buttons.children[4].children[2].active = true;
    }

    hideAllBtnIcon() {
        this.buttons.children.forEach((e, i) => {
            e.children[0].active = false;
            e.children[2].active = false;
        })
    }

    update(deltaTime: number) {

    }
}


